package br.pucrio.inf.les.SPLAnalyser.operations;

import java.lang.reflect.InvocationTargetException;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;

import br.pucrio.inf.les.SPLAnalyser.core.SquidAnalyserFacade;
import br.pucrio.inf.les.SPLAnalyser.impl.extractor.GenarchExtractor;
import br.pucrio.inf.les.SPLAnalyser.impl.query.experimentos.RastreabilidadeFeatureExperimento2;
import br.pucrio.inf.les.SPLAnalyser.impl.sourcecodeanalyser.ast.JavaASTAnalyser;
import br.pucrio.inf.les.SPLAnalyser.impl.visualize.AnalysisModelVisualize;
import br.pucrio.inf.les.genarch.core.project.GenarchProjectConfigurationFile;



public class ChangeImpactAnalysisOperation implements IRunnableWithProgress {
	
	private IProject project;
	

	public ChangeImpactAnalysisOperation(IProject project) {
		this.project = project;			
	}

	public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
		GenarchProjectConfigurationFile genarchProjectConfigurationFile = GenarchProjectConfigurationFile.open(project);
		GenarchExtractor genarchExtractor = new GenarchExtractor();
//		DependenciesOfAsset dependenciesOfAsset = new DependenciesOfAsset("OperacaoSubtracaoTeste.java","br.pucrio.inf.les.genarch.exemplos.teste",DependenciesOfAsset.CLAZZ);
//		ImpactOfAChangeAsset impactOfAChangeAsset = new ImpactOfAChangeAsset("PhotoViewController.java","lancs.mobilemedia.core.ui.controller",DependenciesOfAsset.CLAZZ);
//		ImpactOfAChangeFeature impactOfAChangeFeature = new ImpactOfAChangeFeature("SmsFeature");
//		FeatureIndirectDependencies featureIndirectDependencies = new FeatureIndirectDependencies("PhotoAlbum", 2);
//		Experimento2 experimento2 = new Experimento2("SmsFeature", 2);
//		Experimento2_v5_v6 experimento2_v5_v6 = new Experimento2_v5_v6("SmsFeature", 2);
//		OptionalArtefactBindings optionalArtefactBindings = new OptionalArtefactBindings();
//		AssetIndirectDependencies assetIndirectDependencies = new AssetIndirectDependencies("PhotoViewController.java","lancs.mobilemedia.core.ui.controller",DependenciesOfAsset.CLAZZ, 2);
//		AssetFeatureBinding featureIndirectBindingsByAsset = new AssetFeatureBinding("OperacaoSubtracaoTeste.java","br.pucrio.inf.les.genarch.exemplos.teste",DependenciesOfAsset.CLAZZ, 3);
		
//		ImpactOfRemoveFeature impactOfRemoveFeature = new ImpactOfRemoveFeature("SmsFeature");
//		Amostragem_02_03 amostragem_02_03 = new Amostragem_02_03("teste", 1);
//		Amostragem_03_04 amostragem_03_04 = new Amostragem_03_04("teste", 2);
//		Amostragem_05_06 amostragem_05_06 = new Amostragem_05_06("", 2);
//		Remocao_04_05 remocao_04_05 =  new Remocao_04_05("Sms", 1);
//		Remocao_02_03 remocao_02_03 = new Remocao_02_03("Favourites",2);
//		Remocao_03_04 remocao_03_04 =  new Remocao_03_04("CopyPhoto", 2);
//		RastreabilidadeFeatureExperimento2 rastreabilidadeFeatureExperimento2 = new RastreabilidadeFeatureExperimento2("Sms");
//		Rastreabilidadev6_v7 rastreabilidadev6_v7 = new Rastreabilidadev6_v7("Music","Photo");
//		RemoveFeatureVisualizer removeFeatureVisualizer = new RemoveFeatureVisualizer();
		
		
		AnalysisModelVisualize analysisModelVisualize = new AnalysisModelVisualize();
//		OptionalArtefactBindingsVisualize optionalArtefactBindingsVisualize = new OptionalArtefactBindingsVisualize();
		
		
		
//		JavaSourceCodeAnalyser javaAnalyser = new JavaSourceCodeAnalyser();
		JavaASTAnalyser astAnalyser = new JavaASTAnalyser();
		SquidAnalyserFacade analyzer = new SquidAnalyserFacade(project, genarchExtractor,astAnalyser);
		analyzer.runSquidAnalyser();
		
//		analyzer.executeQuery(rastreabilidadeFeatureExperimento2, analysisModelVisualize);
//		analyzer.executeQuery(dependenciesOfAsset, analysisModelVisualize);
//		analyzer.executeQuery(impactOfAChangeAsset, analysisModelVisualize);
//		analyzer.executeQuery(impactOfAChangeFeature, analysisModelVisualize);
//		analyzer.executeQuery(experimento2, analysisModelVisualize);
//		analyzer.executeQuery(experimento2_v5_v6, analysisModelVisualize);
//		analyzer.executeQuery(assetIndirectDependencies, analysisModelVisualize);
//		analyzer.executeQuery(featureIndirectBindingsByAsset, analysisModelVisualize);
//		analyzer.executeQuery(optionalArtefactBindings, optionalArtefactBindingsVisualize);
	}
}

